name = input('请输入名称：')
id = input('请输入编号：')
price = input('请输入价格：')

print('-'*20,end='\n')
print(type(name),type(id),type(price))
print(f'名称：{name}，编号：{id}，价格：{price * 2}')

print('-'*20,end='\n')
# 字符串转为整型类型
id = int(id)
# 字符串转为浮点类型
price = float(price)

print(type(name),type(id),type(price))
print(f'名称：{name}，编号：{id}，价格：{price * 2}')

print('-'*20,end='\n')
number = 10.88
print(type(number))
print(number)

print('-'*20,end='\n')
# 浮点型转为整型，会导致小数点后的数值消失
number = int(number)
print(type(number))
print(number)

print('-'*20,end='\n')

# 整型转为浮点型
number = float(number)
print(type(number))
print(number)

# 字符串转换为数值类型会自动识别是否能够转换为相应数据类型
str = int('cxd')
str = float('cxd')
print(type(str))
print(str)

# eval()自动转换为相应类型
name = eval(input('请输入名称：'))
id = eval(input('请输入编号：'))
price = eval(input('请输入价格：'))

print('-'*20,end='\n')
print(type(name),type(id),type(price))
print(f'名称：{name}，编号：{id}，价格：{price * 2}')